% Mutate based on probability
function [mutatedPopulation] =  hw8Mutate(population, mutationRate)
mutatedPopulation = population;
[popSize, popElem] = size(population);
% find number of hypotheses to be mutated
numToBeMutated = int16(mutationRate*popSize);

for i=1:numToBeMutated
    % mutate at random point to random hypothesis
    popToMutate = ((popSize - 1)*rand(1)+1);
    mutationPoint = ((popElem - 1)*rand(1)+1);
    mutatedPopulation(popToMutate, mutationPoint) = ~population(popToMutate, mutationPoint);
end
